package com.gmail.bogatyr.alexander.domain;

import org.springframework.roo.addon.equals.RooEquals;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.entity.RooJpaEntity;
import org.springframework.roo.addon.serializable.RooSerializable;
import org.springframework.roo.addon.tostring.RooToString;

import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@RooJavaBean
@RooToString
@RooJpaEntity
@RooEquals
@RooSerializable
public class Comment extends BaseEntity {

    /**
     */
    @NotNull
    @Size(max = 50)
    private String authorName;

    /**
     */
    @NotNull
    @Size(max = 256)
    private String message;

    /**
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "post", referencedColumnName = "id")
    private Post post;
}
